package com.hpjz.common.utils;

import java.io.UnsupportedEncodingException;

import lombok.extern.log4j.Log4j;

import org.apache.commons.codec.digest.DigestUtils;

/**
 * 编码工具类
 * 
 * @author bbchen
 *
 */
@Log4j
public class CodeUtils {
	
	private CodeUtils(){
		
	}
	
	 /**
	  * 将字符串转换为md5加密方式
	  * @param codeStr
	  * @return
	  */
	public static String strToMD5(String codeStr){
		String md5Str = "";
		 try {
			 md5Str = DigestUtils.md5Hex(codeStr.getBytes("UTF-8"));
		} catch (UnsupportedEncodingException e) {
			log.info("字符串"+codeStr+"无法转化为MD5!",e);
		}
		return md5Str;
	}
	
	

}
